package com.test.mchelepesa.bean_rice.user_info_rice;

import com.test.mchelepesa.util_rice.StringUtil_rice;
import com.google.gson.Gson;

import org.json.JSONObject;

public class RepayInfo_rice {

    private static class Inner {
        private static RepayInfo_rice instance = new RepayInfo_rice();
    }

    private RepayInfo_rice(){}

    public static RepayInfo_rice getInstance(){
        return Inner.instance;
    }

    private String amount;
    private String interest;
    private String repayDate;
    private String overdueDay;
    private String overdueAmount;
    private String repayAmount;
    private String partRepayFlag;
    private String days;
    private String tenure;
    private String processingFee;
    private String repayProFee;
    private String remainDay;
    private String serviceFee;
    private String currency;
    //尼日paystack还款
    private String bankCardNo;
    private String expiryYear;
    private String expiryMonth;
    private String cvv;
    //尼日线下还款
    private String virtualBankAccount;
    private String virtualBankName;

    public static void parse(JSONObject objJson){
        Inner.instance = new Gson().fromJson(objJson.toString(), RepayInfo_rice.class);
    }

    public String getAmount() {
        return StringUtil_rice.getSafeString(amount);
    }

    public String getInterest() {
        return StringUtil_rice.getSafeString(interest);
    }

    public String getRepayDate() {
        return StringUtil_rice.getSafeString(repayDate);
    }

    public String getOverdueDay() {
        return StringUtil_rice.getSafeString(overdueDay);
    }

    public boolean isOverdue(){
        return StringUtil_rice.safeParseInt(overdueDay)>0;
    }

    public double getServiceFee() {
        try {
            return Double.parseDouble(serviceFee);
        }catch (Exception e){
            StringUtil_rice.printException(e);
        }
        return 0;
    }

    public String getOverdueAmount() {
        return StringUtil_rice.getSafeString(overdueAmount);
    }

    public String getRepayAmount() {
        return StringUtil_rice.getSafeString(repayAmount);
    }

    public String getPartRepayFlag() {
        return StringUtil_rice.getSafeString(partRepayFlag);
    }

    public String getDays() {
        return StringUtil_rice.getSafeString(days);
    }

    public String getTenure() {
        return StringUtil_rice.getSafeString(tenure);
    }

    public String getProcessingFee() {
        return StringUtil_rice.getSafeString(processingFee);
    }

    public double getRepayProFee() {
        try {
            return Double.parseDouble(repayProFee);
        }catch (Exception e){
            StringUtil_rice.printException(e);
        }
        return 0;
    }

    public String getRemainDay() {
        return StringUtil_rice.getSafeString(remainDay);
    }

    public String getBankCardNo() {
        return StringUtil_rice.getSafeString(bankCardNo);
    }

    public String getExpiryYear() {
        return StringUtil_rice.getSafeString(expiryYear);
    }

    public String getExpiryMonth() {
        return StringUtil_rice.getSafeString(expiryMonth);
    }

    public String getCvv() {
        return StringUtil_rice.getSafeString(cvv);
    }

    public String getCurrency() {
        return StringUtil_rice.getSafeString(currency);
    }

    public String getVirtualBankAccount() {
        return StringUtil_rice.getSafeString(virtualBankAccount);
    }

    public String getVirtualBankName() {
        return StringUtil_rice.getSafeString(virtualBankName);
    }
}
